// pages/main/me/favourite/index.js
var QQMapWX = require('../../../../utils/qqmap-wx-jssdk.min.js');

Page({


  data: {
    list: []
  },


  onLoad: function (options) {


    var qqmapsdk = new QQMapWX({
      key: getApp().$QQMapKey // 必填
    });


    console.log(getApp().globalData.latitude + "," + getApp().globalData.longitude);


    qqmapsdk.reverseGeocoder({

      location: getApp().globalData.latitude + "," + getApp().globalData.longitude,


      success: function (res) {
        console.log(res);
      }
    })
  },

  btnCancel: function (e) {
    let that = this;
    let data = {
      recruitId: e.currentTarget.id,
      operationType: 1,
    }
    getApp().$http.deleteFromFavouriteList(data).then(res => {
      wx.showToast({
        title: '取消成功',
      })
      that.getDataList();
    });
  },

  onShow: function () {
    this.getDataList();
  },


  getDataList: function () {
    wx.showNavigationBarLoading();
    let that = this;
    let collections_list = {
      lat: getApp().globalData.latitude,
      lng: getApp().globalData.longitude,
      myFavorite: true
    }
    getApp().$http.getMyFavouriteList(collections_list).then(res => {
      wx.hideNavigationBarLoading({
        success: (res) => {},
      });
      that.setData({
        list: res
      })
    });
  },

  onPullDownRefresh: function () {

  },

})